#!/usr/bin/env bash

__rvm_notes_warning_gemrc()
{
  if
    [[ -z "${rvm_ignore_gemrc_issues:-}" ]]
  then
    \typeset _check _gemrc _found
    _found=0

    for _gemrc in "/etc/gemrc" "${HOME}/.gemrc"
    do
      if
        [[ -r "${_gemrc}" ]]
      then
        for _check in " -n" --user-install gemhome gempath
        do
          if
            __rvm_grep -E -- '^'"${_check}"'|^[^#]*'"${_check}" "${_gemrc}" >/dev/null
          then
            (( _found++ ))
            rvm_warn "  * WARNING: Found <code>${_check}</code> <warn>in <code>${_gemrc}</code><warn>, please remove it, as it will break rubygems in RVM."
          fi
        done
      fi
    done
    if
      (( _found ))
    then
      rvm_warn "    If it is intended or a mistake <code>export rvm_ignore_gemrc_issues=1</code> <warn>to avoid this warning.\n"
    fi
  fi
}

__rvm_notes_warning_gemrc
